#version 150

in vec2 Texcoord;

out vec4 outColor;

uniform sampler2D postprocTexture;
uniform sampler2D glowmapTexture;

const float blurSizeH = 1.0 / 200.0;
const float blurSizeV = 1.0 / 150.0;

void main()
{
	vec3 sum = vec3(0.0);
	
	for (int x = -4; x <= 4; ++x)
	{
		for (int y = -4; y <= 4; ++y)
		{
			sum += (texture(glowmapTexture, vec2(Texcoord.x + x * blurSizeH, Texcoord.y + y * blurSizeV)).rgb) / 81.0;
		}
	}

	outColor.rgb = texture(postprocTexture, Texcoord).rgb + sum;
	outColor.a = 1.0;
}